var keyword = "";
var pageSize = 10; // 定义每页显示n条数据
var curPage = 1; // 当前页码  默认1

function dataList(pageNo, keyword) {
	datagrid = $("#variety-content").datagrid({
    	pageNo: pageNo,
        pageSize: pageSize,
//      queryParams: "title="+keyword+"&summary="+keyword,
        queryParams: "title="+keyword,
        url : "../../article/page.do", // 你请求的地址
        pagination: "pagination",
        scriptHtml: "variety-template",
        table: "eTableRow",
        isPagination: true
    });
}

//跳转新闻详情页
function myClick(id){
	window.location.href = '../listPage/searchDetail.html?id='+id;
}

//获取URL参数
function GetRequest() {
	var url = location.search; //获取url中"?"符后的字串
	//console.log(url);
	url = decodeURI(decodeURI(url));
	//console.log(url);
	var theRequest = new Object();
	if (url.indexOf("?") != -1) {
	  var str = url.substr(1);
	  strs = str.split("&");
	  for(var i = 0; i < strs.length; i ++) {
	     theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[1]);
	  }
	}
	return theRequest;
}

//中文字符，ASCII值互转，解决JS里中文显示到页面出现乱码的问题
//alert('\u975e\u5b98\u65b9\u7684\u4e2a');
function native2ascii(nativecode) {
nativecode = nativecode.split("");
var ascii = "";
for (var i = 0; i < nativecode.length; i++) {
    var code = Number(nativecode[i].charCodeAt(0));
    if (code > 127) {
        var charAscii = code.toString(16);
        charAscii = new String("0000").substring(charAscii.length, 4) + charAscii;
        ascii += "\\u" + charAscii;
    } else {
        ascii += nativecode[i];
    }
}
return ascii;
}

function ascii2native(asciicode) {
asciicode = asciicode.split("\\u");
var nativeValue = asciicode[0];
for (var i = 1; i < asciicode.length; i++) {
    var code = asciicode[i];
    nativeValue += String.fromCharCode(parseInt("0x" + code.substring(0, 4)));
    if (code.length > 4) {
        nativeValue += code.substring(4, code.length);
    }
}
return nativeValue;
}
